package org.tgcloud.group.web.listener;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.tgcloud.group.core.LockUtil;
import org.tgcloud.group.core.RedisUtil;

@Component
public class ApplicationStartedEventListener implements ApplicationListener<ApplicationStartedEvent> {


    private final RedisTemplate redisTemplate;

    @Autowired
    public ApplicationStartedEventListener(RedisTemplate redisTemplate) {
        this.redisTemplate = redisTemplate;
    }

    @Override
    public void onApplicationEvent(ApplicationStartedEvent event) {
        RedisUtil.setRedisTemplate(redisTemplate);
        LockUtil.setRedisTemplate(redisTemplate);

    }

}
